import http from "@/utils/request"

// 获取基地对应的鸽棚
export function getData(data) {
  return http({
    url: `/breed/manual-incubation/getByDovecoteNumber?baseId=${data.baseId}&dovecoteNumber=${data.dovecoteNumber}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'get',
  });
}

// 添加记录
export function addRecord(data) {
    return http({
      url: `/breed/manual-incubation/addManualIncubationData`,
      method: 'post',
      data: data
    });
}

// 编辑数据
export function editRecord(id, data) {
  return http({
    url: `/breed/manual-incubation/updateData?id=${id}`,
    method: 'post',
    data: data
  });
}

// 删除数据
export function deleteRecord(id) {
  return http({
    url: `/breed/manual-incubation/deleteDataById?id=${id}`,
    method: 'delete',
  });
}

// 清零
export function toZero(id) {
  return http({
    url: `/breed/manual-incubation/toZero?id=${id}`,
    method: 'get'
  });
}

// 获取7天
export function getSevenDay(data) {
  return http({
    url: `/breed/manual-incubation/get7DayOfOneIncubation?baseId=${data.baseId}&dovecoteNumber=${data.dovecoteNumber}`,
    method: 'get'
  });
}

export function getSevenDayDetail(data) {
  return http({
    url: `/breed/manual-incubation/getSevenDay?baseId=${data.baseId}&dovecoteNumber=${data.dovecoteNumber}`,
    method: 'get'
  });
}


// 根据日期获取
export function getByDate(data) {
  return http({
    url: `/breed/manual-incubation/getByDate?baseId=${data.baseId}&year=${data.year}&month=${data.month}&day=${data.day}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'get'
  });
}

// 导出Excel
export function exportExcel(id) {
  return http({
    url: `/breed/manual-incubation/exportData?baseId=${id}`,
    method: 'get',
    responseType: 'blob',
    header: {
      headers: { 'Content-Type': 'application/x-download' }
    },
  });
}